<?php
/**
 * Created by PhpStorm.
 * User: qishengqiang
 * Date: 2022-05-09
 * Time: 18:32
 */

namespace app\models;


use think\facade\Config;

class Users extends ModelBase
{
    protected $pk = "userId";

    public function university()
    {
        return $this->hasOne(Universities::class, 'universityId', 'universityId');
    }

    public function getStatusText()
    {
        $text = '';
        switch($this->status){
            case 0:
                $text = '关闭';
            break;
            case 1:
                $text = '开启';
            break;
        }
        return $text;
    }

    public function getGenderText()
    {
        $text = '';
        switch($this->gender){
            case 0:
                $text = '未知';
                break;
            case 1:
                $text = '男';
                break;
            case 2:
                $text = '女';
                break;
        }
        return $text;
    }

    /**
     * @return mixed
     */
    public function getGradeText()
    {
        $grades = ['1' => '大一', '2' => '大二', '3' => '大三', '4' => '大四', '5' => '研一', '6' => '研二', '7' => '研三'];

        return $this->grade?$grades[$this->grade]:'';
    }
}